<?php include dirname(__FILE__).'/common/header.php'; ?>

<?php include dirname(__FILE__).'/common/menu.php'; ?>

var attr = {};
attr.ctrlName = '<?php echo $ctrlName; ?>';

/*
| -------------------------------------------------------------------
|  List Grid
| -------------------------------------------------------------------
*/
var grid = new ZM.GridPanel({
    url: list.baseUrl + attr.ctrlName+'/getReadingQuanityList',
    region:'center',
    /*tbar:[{
        text:'导出排行榜',
        cls:'btn-show',
        hidden:!Ext.permission[attr.ctrlName + '/exportList'.toLowerCase()],
        handler:function() {
            location.href = list.baseUrl + attr.ctrlName + '/exportList';
        }
    }],*/
    columns:[
        //{header:'用户ID',dataIndex:'user_id',filter:{},width:80},
        //{header:'店铺编码',dataIndex:'user_code',filter:{}},
        {header:'店铺名称',dataIndex:'user_name',filter:{}},
        {header:'排名',dataIndex:'rank'},
        {header:'阅读量',dataIndex:'quanity'},
        {header:'图片',dataIndex:'image_path',renderer:ZM.cellImage},
        {header:'最后修改时间',dataIndex:'reading_quanity_time_create',width:140,filter:{xtype:'daterangefield'}},
        {header:'操作',renderer:function(v,p,r){
            var str = '';
            str += Ext.rd('修正','fireDetail',r,attr.ctrlName+'/updateQuanity');
            return str;
        }}

    ]
});

var imagePanel = new Ext.Container({
    html:'das',
    region:'east',
	split:true,
	collapseMode:'mini',
	collapsible:true,
	autoScroll:true,
    width: 450
});

/*
list.grid = new Ext.Container({
	region:'center',
    layout:'border',
    items:[grid,imagePanel]
});
*/
list.grid = grid;

grid.fireDetail = function(r) {
    var r = r.json;
    var win = new ZM.PopUp({
        title:'修正['+r.user_code+'-'+r.user_name+']阅读量数据',
        type:'s',
        items:{
            xtype:'formpanel',
            url:list.baseUrl+ attr.ctrlName+'/updateQuanity',
            success:function(res) {
                ZM.bo.msg('success',res.detail);
                list.grid.store.reload();
                win.close();
            },
            items:[{
                xtype:'hidden',
                name:'user_id',
                value: r.user_id
            },{
                xtype:'intfield',
                fieldLabel:'阅读量',
                name:'quanity',
                value:r.quanity,
                allowBlank:false
            }]
        }
    }).show();
}

<?php include dirname(__FILE__).'/common/layout.php'; ?>
grid.store.load();
<?php include dirname(__FILE__).'/common/footer.php'; ?>
